#include<iostream>
#include<string>
using namespace std;

class Node{
    private:
        string name;
        Node* next;
    public:
        Node(string PersonName){
            this->name=PersonName;
            this->next=NULL;    
        }
        friend class List;
};

class List{
        private:
            Node* head;
        public:
            List(){
                this->head=NULL;}
                void add(string PersonName){
                    Node* NewNode=new Node(PersonName);
                    if(head==NULL){
                     this->head=NewNode;}
                     else{
                         Node* temp=head;
                         while(temp->next!=NULL)
                         temp=temp->next;
                         temp->next=NewNode;    
                     }
                }
                void Printnames(){
                    if (head ==NULL){
                        cout<<"List is empty"<<endl;
                    }
                    Node* temp=head;
                    while(temp!=NULL){
                        cout<<temp->name<<endl;
                        temp=temp->next;
                    }
                    cout<<endl;
    }
    ~List(){
        Node* temp=head;
        while(temp!=NULL){
            Node* del=temp;
            temp=temp->next;
            delete del;
    }}
    
};
int main(){
    List L;
   for(int i=1;i<20;i++) {
    string name="Person"+to_string(i);
    L.add(name);
   }    
    
    L.Printnames();
    return 0;
}